package com.njtoyo.taxi.admin.rest.controller.business.driver;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.njtoyo.taxi.admin.aop.PermissionScope;
import com.njtoyo.taxi.admin.mongo.entity.secondary.AdminDeductDriverScoreLogMongo;
import com.njtoyo.taxi.admin.rest.wrapper.business.driver.DriverRewardAddOrUpdateWrapper;
import com.njtoyo.taxi.admin.rest.wrapper.business.driver.ScoreDeductingLogQueryWrapper;
import com.njtoyo.taxi.admin.service.business.driver.DriverRewardService;
import com.taxi.entity.common.RestResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageImpl;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("business/driver-reward")
public class DriverRewardController {

    @Autowired
    private DriverRewardService driverRewardService;


    @PostMapping("/add")
    RestResult add(@RequestBody DriverRewardAddOrUpdateWrapper wrapper) {
        if (CollUtil.isEmpty(wrapper.getDriverIds())) {
            return RestResult.failed("请选择需要发放奖励的司机");
        }
        if (ObjectUtil.isNull(wrapper.getRewardAmount())) {
            return RestResult.failed("请填要发放奖励金额");
        }
        return driverRewardService.add(wrapper);
    }


}
